package com.ecity.table {
	import com.ecity.util.HashMap;
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import gs.easing.*;
	import gs.TweenLite;
	
	/**
	 * ...
	 * @author yicheng.zhang
	 */
	public class TableDisplayObject extends Sprite {
		private var _layerMap:HashMap;
		private var angle:int=0;
		private var isPrompt:Boolean;
		private var bg:DisplayObject;
		
		//public var 
		
		public function TableDisplayObject() {
			_layerMap = new HashMap();
			isPrompt = true;
		}
		
		protected function clearLayer(layer:Sprite):void {
			while (layer.numChildren) {
				layer.removeChildAt(0);
			}
		}
		
		protected function getLayer(name:String):Sprite {
			var layer:Sprite;
			if (_layerMap.containsKey(name)) {
				layer = _layerMap.get(name);
			}else {
				layer  = new Sprite();
				layer.name = "layer_" + name;
				_layerMap.put(name, layer);
				this.addChild(layer);
			}
			return layer;
		}
		
		protected function removeLayer(name:String):void {
			var layer:Sprite;
			if (_layerMap.containsKey(name)) {
				layer = _layerMap.get(name);
				this.removeChild(layer);
				_layerMap.remove(name);
			}
		}
		
		
		public function open():void {
			if (!isPrompt) {
				TweenLite.to(this, 1, { scaleX:1, scaleY:1, ease:Back.easeIn});
				isPrompt = true;
			}
		}
		
		public function shut():void {
			if (isPrompt) {
				TweenLite.to(this, 1, {scaleX:0, scaleY:0, ease:Back.easeIn});
				isPrompt = false;
			}
		}

		
	}

}